package br.edu.unifei.mestrado.mem.graph;

import br.edu.unifei.mestrado.commons.graph.NodeWrapper;
import br.edu.unifei.mestrado.commons.graph.RelationshipWrapper;

public class RelationshipMem implements RelationshipWrapper {

	private Relationship relationship;

	public RelationshipMem(Relationship relationship) {
		this.relationship = relationship;
	}

	@Override
	public int getWeight() {
		return relationship.getWeight();
	}

	@Override
	public long getId() {
		return relationship.getId();
	}

	@Override
	public NodeWrapper getOtherNode(NodeWrapper node) {
		return new NodeMem(relationship.getOtherNode(((NodeMem)node).getInnerNode()));
	}

	@Override
	public boolean isRelationshipOnCut() {
		return relationship.isCut();
	}

	@Override
	public NodeWrapper getStartNode() {
		return new NodeMem(relationship.getStartNode());
	}

	@Override
	public NodeWrapper getEndNode() {
		return new NodeMem(relationship.getEndNode());
	}
	
	public Relationship getInnerObj() {
		return relationship;
	}
	
	public Relationship getInnerRelationship() {
		return relationship;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof RelationshipMem) {
			return relationship.equals(((RelationshipMem)obj).getInnerRelationship());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return relationship.hashCode();
	}
	
	@Override
	public String toString() {
		return relationship.toString();
	}

	
}
